package com.antler.smt.portal.service.impl;

import com.antler.smt.entity.QuestionnaireEntity;
import com.antler.smt.portal.mapper.QuestionnaireEntityMapper;
import com.antler.smt.request.portal.QuestionReq;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.portal.SourceService;
import com.antler.smt.utils.DateUtil;
import com.antler.smt.utils.ReturnResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 来源服务
 *
 * @author zhangyi
 * @date 2018/9/25 11:02
 */
@Service
public class SourceServiceImpl implements SourceService {

    @Autowired
    private QuestionnaireEntityMapper questionnaireEntityMapper;

    @Override
    public Result addSources(QuestionReq questionReq) {
        QuestionnaireEntity questionnaireEntity = new QuestionnaireEntity();
        questionnaireEntity.setSource(questionReq.getSource());
        questionnaireEntity.setMemberid(questionReq.getMemberid());
        questionnaireEntity.setCreateTime(DateUtil.stampToDate(System.currentTimeMillis()));
        int i = questionnaireEntityMapper.insertSelective(questionnaireEntity);
        return ReturnResultUtil.getResult("插入成功","插入失败",i);
    }
}
